package com.dingding.common.core.config;

import org.apache.log4j.Logger;

/**
 * 
 * @ClassName: WeChatConfig 
 * @Description: 微信相关配置类
 * @author CHEHAUNBO 
 * @date 2016年5月26日 下午4:02:41
 * 
 */
public class WeChatConfig extends AbstractConfig {

	private static final Logger log = Logger.getLogger(WeChatConfig.class);

	private static String ENV_WECHAT_PAY = "Produce"; // 环境

	// 出租车订单微信支付回调URL
	private static String WECHAT_NOTIFY_URL = Constants.PRODUCT_DOMAIN_NAME + Constants.WECHAT_PAY_NOTIFY_URL;

	// 私家车订单微信支付回调URL
	private static String TXT_WECHAT_NOTIFY_URL = Constants.PRODUCT_DOMAIN_NAME + Constants.WECHAT_PAY_TAXI_NOTIFY_URL;

	//专车卫星订单支付的回调URL
	private static String SPECIAL_WECHAT_NOTIFY_URL = Constants.PRODUCT_DOMAIN_NAME + Constants.SPECIAL_PAY_NOTIFY;
	
	/**
	 * 初始化微信支付配置
	 * @Title: intitalConfigValue 
	 * @author CHEHAUNBO
	 * 
	 */
	@Override
	public void intitalConfigValue() {

		String flag = prop.get("env_wechat_pay");

		if ("dev".equals(flag)) { // 开发环境
			ENV_WECHAT_PAY = "dev";
			TXT_WECHAT_NOTIFY_URL = Constants.DEV_DOMAIN_NAME + Constants.WECHAT_PAY_TAXI_NOTIFY_URL;
			WECHAT_NOTIFY_URL = Constants.DEV_DOMAIN_NAME + Constants.WECHAT_PAY_NOTIFY_URL;
			SPECIAL_WECHAT_NOTIFY_URL = Constants.DEV_DOMAIN_NAME + Constants.SPECIAL_PAY_NOTIFY;
		} else if ("test".equals(flag)) { // 测试环境
			ENV_WECHAT_PAY = "test";
			TXT_WECHAT_NOTIFY_URL = Constants.TEST_DOMAIN_NAME + Constants.WECHAT_PAY_TAXI_NOTIFY_URL;
			WECHAT_NOTIFY_URL = Constants.TEST_DOMAIN_NAME + Constants.WECHAT_PAY_NOTIFY_URL;
			SPECIAL_WECHAT_NOTIFY_URL = Constants.TEST_DOMAIN_NAME + Constants.SPECIAL_PAY_NOTIFY;
		}

		log.info("正在初始化微信支付相关配置！初始化后的值：" + toString());

	}

	public static String getENV_WECHAT_PAY() {
		return ENV_WECHAT_PAY;
	}

	public static void setENV_WECHAT_PAY(String eNV_WECHAT_PAY) {
		ENV_WECHAT_PAY = eNV_WECHAT_PAY;
	}

	public static String getWECHAT_NOTIFY_URL() {
		return WECHAT_NOTIFY_URL;
	}

	public static void setWECHAT_NOTIFY_URL(String wECHAT_NOTIFY_URL) {
		WECHAT_NOTIFY_URL = wECHAT_NOTIFY_URL;
	}

	public static String getTXT_WECHAT_NOTIFY_URL() {
		return TXT_WECHAT_NOTIFY_URL;
	}

	public static void setTXT_WECHAT_NOTIFY_URL(String tXT_WECHAT_NOTIFY_URL) {
		TXT_WECHAT_NOTIFY_URL = tXT_WECHAT_NOTIFY_URL;
	}

	@Override
	public String toString() {
		return "支付环境：" + ENV_WECHAT_PAY + "[WECHAT_NOTIFY_URL]:" + WECHAT_NOTIFY_URL + "[TXT_WECHAT_NOTIFY_URL]:"
				+ TXT_WECHAT_NOTIFY_URL;
	}

	public static String getSPECIAL_WECHAT_NOTIFY_URL() {
		return SPECIAL_WECHAT_NOTIFY_URL;
	}

	public static void setSPECIAL_WECHAT_NOTIFY_URL(String sPECIAL_WECHAT_NOTIFY_URL) {
		SPECIAL_WECHAT_NOTIFY_URL = sPECIAL_WECHAT_NOTIFY_URL;
	}

}
